var Main;
(function(){
	var rect; //敌人;
	var text; //文本
	var star; //星星;
	var score=10; //分
	var hitNum=0;   //击中的个数
	Main = function(){
		
		Main.prototype.init();
	}
	Main.prototype.init=function()
	{
		
		OBODY.style.background="url("+BG+") no-repeat center top";
		OBODY.style.overflow="hidden";
		OBODY.style.height=CLIENTHEIGHT+"px";
		
		text = new Text();
		text.init();
		
		rect = new oTuZi();
		rect.init();	
		
		star = new Star(50);
		star.init();
		
		//添加经过事件;
		Main.prototype.addOverEvent();
		//计时
		Main.prototype.getTimeJs();
		//页面发生改变;
		Main.prototype.scrollSize();
		//背景抖动;
		Main.prototype.bgMove();
	}
	Main.prototype.bgMove=function()
	{
		var x,y;
		setInterval(function(){
			x=0.6*Math.random()+0.7
			y=0.6*Math.random()+0.4
			OBODY.style.backgroundPosition =x+"% "+y+"%";
		},500)
	}
	Main.prototype.scrollSize=function()
	{
		CLIENTHEIGHT = document.body.clientHeight || document.documentElement.clientHeight; //页面高度;
		CLIENTWIDTH  = document.body.clientWidth || document.documentElement.clientWidth;    //页面宽度
		var divElements,i;		
		window.onresize=function(){;
			divElements = document.getElementsByTagName("div");
			for(i=0;i<CLEARBARR.length;i++)
			{
				//clearTimeout(CLEARBARR[i])
			}
		}	
	}
	Main.prototype.getTimeJs=function()
	{
		var jsDate=0.01;
		var hours='';
		var hoursIndex=0;
		JSOBJ = document.getElementById(JS); 
		setInterval(function(){
			jsDate+=0.01;
			JSOBJ.value=hours+jsDate.toFixed(2)+"秒";
		},9)
	}
	Main.prototype.addOverEvent=function()
	{
		HITOBJ = document.getElementById(JZ); 
		SCOREOBJ = document.getElementById(DF); 
		document.addEventListener("click",onOver,false);
		function onOver()
		{
			if(event.target.parentNode.getAttribute("numIndex"))
			{
				hitNum++
				HITOBJ.value=""+hitNum;
				SCOREOBJ.value =""+ hitNum*score
				oTuZi.prototype.clearEventElement(event.target.parentNode);	
			}
		}
		
	}
	
})();